import request from '@/utils/request'

// 查询携程订单列表
export function listCtrip(query) {
  return request({
    url: '/ota/ctrip/list',
    method: 'get',
    params: query
  })
}
export function selectOrderCount(query) {
  return request({
    url: '/ota/ctrip/selectOrderCount',
    method: 'get',
    params: query
  })
}
// 查询携程订单详细
export function getCtrip(orderEncryptId) {
  return request({
    url: '/ota/ctrip/' + orderEncryptId,
    method: 'get'
  })
}

// 查询携程同步配置
export function getConfig() {
  return request({
    url: '/grap/config/list',
    method: 'get'
  })
}

// 新增携程订单
export function addCtrip(data) {
  return request({
    url: '/ota/ctrip',
    method: 'post',
    data: data
  })
}

// 同步订单
export function syncData(data) {
  return request({
    url: '/ota/ctrip/syncData',
    method: 'post',
    data: data
  })
}

// 查询【请填写功能名称】列表
export function listLog(query) {
  return request({
    url: '/grap/log/list',
    method: 'get',
    params: query
  })
}

// 修改携程订单
export function updateCtrip(data) {
  return request({
    url: '/ota/ctrip',
    method: 'put',
    data: data
  })
}

// 删除携程订单
export function delCtrip(orderEncryptId) {
  return request({
    url: '/ota/ctrip/' + orderEncryptId,
    method: 'delete'
  })
}

// 导出携程订单
export function exportCtrip(query) {
  return request({
    url: '/ota/ctrip/export',
    method: 'get',
    params: query
  })
}

// ota同步获取数据
export function otamodellist(query) {
  return request({
    url: '/ctrip/model/list',
    method: 'get',
    params: query
  })
}

// 下拉车型数据查询
export function listByAvailable(query) {
  return request({
    url: '/car/business/listByAvailable',
    method: 'get',
    params: query
  })
}

// ota同步获取数据
export function otamodelsave(data) {
  return request({
    url: '/ctrip/model',
    method: 'put',
    data: data
  })
}

// 门店映射查询接口
export function otastorelist(query) {
  return request({
    url: '/ctrip/store/list',
    method: 'get',
    params: query
  })
}

//门店映射批量新增编辑
export function otactripsave(data) {
  return request({
    url: '/ctrip/store',
    method: 'put',
    data: data
  })
}

// 查询门店下拉框列表
export function getAllStore(query) {
  return request({
    url: '/store/store/getAllStore',
    method: 'get',
    params: query
  })
}

// 【OTA平台账号】获取列表数据
export function getOTAccount(query) {
  return request({
    url: '/ctrip/account/config/list',
    method: 'get',
    params: query
  })
}

//【OTA平台账号】批量更新
export function saveOTAccount(data) {
  return request({
    url: '/ctrip/account/config',
    method: 'post',
    data: data
  })
}

// 【OTA工单】获取列表
export function getOTAWorkorder(query) {
  return request({
    url: '/ota/workorder/complete/list',
    method: 'get',
    params: query
  })
}
export function getOtaAccountlist() {
  return request({
    url: '/ota/workorder/complete/otaAccountlist',
    method: 'get'
  })
}

// 【OTA工单】工单新增接口
export function addOTAWorkorder(data) {
  return request({
    url: '/ota/workorder',
    method: 'post',
    data: data
  })
}

// 【ota工单】一键释放接口
export function otaWorkorderQuickRelease(id) {
  return request({
    url: '/ota/workorder/'+id+'/quickRelease',
    method: 'post'
  })
}

// 【OTA工单】修改工单状态
export function updateOTAWorkorderStatus(data) {
  return request({
    url: '/ota/workorder/stauts/update',
    method: 'post',
    data: data
  })
}

// 获取车型设置列表
export function autosyncCarList(query) {
  return request({
    url: '/ctrip/car/autosync/list/all',
    method: 'get',
    params: query

  })
}

// 修改车型自动占用/释放
export function updateAutosync(data) {
  return request({
    url: '/ctrip/car/autosync',
    method: 'put',
    data: data
  })
}

// 获取租户全局自动占用/释放
export function getTenantAutoSyncStatus(query) {
  return request({
    url: '/ctrip/tenant/config',
    method: 'get',
    params: query

  })
}

// 修改车型自动占用/释放
export function updateTenantAutoSyncStatus(data) {
  return request({
    url: '/ctrip/tenant',
    method: 'put',
    data: data
  })
}


// OTA单个同步获取订单信息
export function otaSyncOrders(id) {
  return request({
    url: '/ota/ctrip/otaSyncOrders/'+id,
    method: 'get'
  })
}

// OTA批量同步订单
export function batchOtaSyncOrders(data) {
  return request({
    url: '/ota/ctrip/batchOtaSyncOrders',
    method: 'post',
    data: data
  })
}

// ota调价列表
export function updataPriceList(data) {
  return request({
    url: '/car/work/list',
    method: 'GET',
    params:{
      priceType:1
    }
  })
}

